﻿#include "FITKPhyscisPropertyUniform.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppSettings.h"
#include <QColor>

namespace Acoustics
{
    FITKPhyscisPropertyUniform::FITKPhyscisPropertyUniform()
    {
        this->updateDefaultColor();
    }

    FITKPhyscisPropertyUniform::~FITKPhyscisPropertyUniform()
    {
    }

    FITKAcousticsAbsPhysicsProp::AcousticsPhyscisPropType FITKPhyscisPropertyUniform::getPhysicsPropType()
    {
        return AcousticsPhyscisPropType::APPUniformPlat;
    }

    double FITKPhyscisPropertyUniform::getThickness() const
    {
        return _thickness;
    }

    void FITKPhyscisPropertyUniform::setThickness(double thickness)
    {
        _thickness = thickness;
    }

    double FITKPhyscisPropertyUniform::getShellThickness()
    {
        //获取均质板的厚度
        return _thickness;
    }

    void FITKPhyscisPropertyUniform::updateDefaultColor()
    {
        //获取软件设置
        AppFrame::FITKAppSettings* settings = FITKAPP->getAppSettings();
        if (!settings) return;
        //获取配置
        QVariant uniform = settings->getVarient("UniformPhyPropColor");
        //更新均质板颜色
        if (uniform.isNull())
        {
            uniform = settings->getVarient("OriUniformPhyPropColor");
            if (uniform.isNull()) return;
        }
        QColor uniformColor = uniform.value<QColor>();
        _color[0] = uniformColor.redF();
        _color[1] = uniformColor.greenF();
        _color[2] = uniformColor.blueF();
    }
}
